#include "Support.h"
#include "StateManager.h"
#include "PlayState.h"
#include "MenuState.h"
#include "WinState.h"

void CPlayState::Init()
{
	char *map = "xxxRxGxMxYxxxxxxRGxxBYCMxxCxxxBxxxxx";
	m_board_game.Init (map);
}

void CPlayState::Release()
{

}

void CPlayState::Pause()
{

}

void CPlayState::Resume()
{

}

void CPlayState::Update()
{
	if (!m_board_game.IsComplete ())
	{
		m_board_game.Update ();
	}
	else
	{
		CStateManager::GetInstance ()->ChangeState (new CWinState ());
	}

	if (GIsKeyPress (KEY_ESC))
	{
		CStateManager::GetInstance ()->ChangeState (new CMenuState ());
	}
}

void CPlayState::Draw()
{
	GPutStringToBufferWithMargin ("Flow", 6, GColors::LIGHT_CYAN);

	m_board_game.Draw ();
}